Skip to content

ci: pin Go toolchain to 1.26.4 and unify version source#770

Open
dlevy-msft-sql wants to merge 1 commit into
microsoft:mainfrom
dlevy-msft-sql:ci/pin-go-toolchain
Open

ci: pin Go toolchain to 1.26.4 and unify version source#770
dlevy-msft-sql wants to merge 1 commit into
microsoft:mainfrom
dlevy-msft-sql:ci/pin-go-toolchain

Conversation

@dlevy-msft-sql
Copy link
Copy Markdown
Contributor

Problem

govulncheck is failing on every PR (e.g. #769 run) with exit code 3:

  • GO-2026-5039net/textproto arbitrary input in errors (reached via container.Controller.ContainerFilesio.ReadAll)
  • GO-2026-5037crypto/x509 inefficient hostname parsing (reached via sqlCmdFormatterType.AddErrorx509.HostnameError.Error)

Both are stdlib bugs fixed in Go 1.26.4. The runner is using 1.26.3.

Root Cause

Two cooperating gaps:

  1. go.mod declared go 1.26 with no toolchain directive, so setup-go resolved "1.26" against its cached release manifest and happily returned 1.26.3 (already in cache) — even though 1.26.4 is published in actions/go-versions.
  2. Two other workflows pinned go-version: '1.26.0' literally, so they drift from go.mod and need manual edits for every Go bump.
  3. Dependabot does not currently update go/toolchain directives (dependabot-core#8454) and stdlib CVEs aren't in require(), so dependabot can't fix this for us.

Solution

File Change Why
go.mod Add toolchain go1.26.4 Declares the minimum acceptable patch in one canonical place. setup-go honors it.
.github/workflows/security.yml Add check-latest: true to setup-go Forces the runner to consult the signed actions/go-versions manifest for the newest matching patch instead of serving a stale cache entry.
.github/workflows/security.yml govulncheck@latestgovulncheck@v1.1.4 Removes a @latest supply-chain edge. The vuln DB itself is fetched at runtime, so DB freshness is unchanged.
.github/workflows/pr-validation.yml go-version: '1.26.0'go-version-file: go.mod + check-latest: true Single source of truth — go.mod is the only place the version lives.
.github/workflows/golangci-lint.yml Same as pr-validation.yml Same — also fixes the pre-existing checkout-before-setup-go ordering.

After this lands, bumping the Go patch is a one-line edit to the toolchain line in go.mod. All three workflows pick it up automatically on the next run.

Testing

  • go build ./... locally with go1.26.4 (auto-downloaded by the toolchain directive) — succeeds.
  • govulncheck will be exercised by this PR's own security.yml run.

Why not split the commits

go.mod and the workflows are one change with one motivating cause (govulncheck failure). Splitting would land the workflow changes first and still leave govulncheck red until the go.mod change merged separately.

Related

Fixes govulncheck failures for GO-2026-5037 (crypto/x509) and GO-2026-5039 (net/textproto), both fixed in Go 1.26.4.

Changes:

- go.mod: add 'toolchain go1.26.4' so go/setup-go know the minimum acceptable patch.

- security.yml, pr-validation.yml, golangci-lint.yml: read version from go.mod (single source of truth) and set 'check-latest: true' so the runner fetches the newest matching patch from the signed actions/go-versions manifest instead of serving a stale cache entry (1.26.3).

- security.yml: pin govulncheck to @v1.1.4 instead of @latest for supply-chain hygiene. The vuln DB itself is fetched at runtime, so this only pins the analyzer binary.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s canonical Go patch level to 1.26.4 (to pick up stdlib security fixes needed for govulncheck) and aligns GitHub Actions workflows to consistently use go.mod as the single version source.

Changes:

  • Add toolchain go1.26.4 to go.mod to declare the minimum acceptable Go patch.
  • Update CI workflows to use go-version-file: go.mod and check-latest: true to avoid stale runner cache patch versions.
  • Pin govulncheck installation to a specific version instead of @latest.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
go.mod Adds toolchain go1.26.4 so CI and developers use the patched Go toolchain.
.github/workflows/security.yml Uses check-latest: true and pins govulncheck to v1.1.4 for more deterministic security scanning.
.github/workflows/pr-validation.yml Switches to go-version-file: go.mod + check-latest: true to avoid workflow drift.
.github/workflows/golangci-lint.yml Reorders steps to checkout before setup-go and unifies Go version sourcing via go.mod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants